<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>string_api</title>
</head>
<body>
    <div>字符串API</div>




</body>

<script>
    /**
     * ECMAScript提供了3个从字符串中提取子字符串的方法：slice()、substr()和substring()
     * */
    void function () {
        let stringValue = "hello world";
        console.log(stringValue.length );
        console.log(stringValue.slice(3));       // "lo world"
        console.log(stringValue.substring(3));   // "lo world"
        console.log(stringValue.substr(3));      // "lo world"
        console.log(stringValue.slice(3, 7));    // "lo w"
        console.log(stringValue.substring(3,7)); // "lo w"
        console.log(stringValue.substr(3, 7));   // "lo worl"
    }();




</script>


</html>
